package com.aion.jirc.irc.wrappers;

/**
 * Created by IntelliJ IDEA.
 * Date: 11-02-18
 * Time: 10:02
 *
 * @author Aion
 */
public class Mode {

    private String name;
    private String parameter;

    public Mode(String name) {
        this.name = name;
    }

    public Mode(String name, String parameter) {
        this.name = name;
        this.parameter = parameter;
    }

    /**
     * Gets this mode's name
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Gets the parameter of this mode.
     *
     * @return the parameter or an empty <code>String</code>
     */
    public String getParameter() {
        if (hasParameter()) {
            return parameter;
        }
        return "";
    }

    /**
     * Checks whether or not this mode has a parameter.
     *
     * @return <tt>true</tt> if this mode has a parameter; otherwise <tt>false</tt>
     */
    public boolean hasParameter() {
        return parameter != null && !parameter.isEmpty();
    }

}
